//
//  DetailVC.m
//  Book
//
//  Created by 123 on 16-4-5.
//  Copyright (c) 2016年 陈凯. All rights reserved.
//

#import "DetailVC.h"
#import "CellOne.h"
@interface DetailVC ()<UITableViewDataSource,UITableViewDelegate>

@end

@implementation DetailVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    _tableview.delegate=self;
    _tableview.dataSource=self;
    UINib*nib=[UINib nibWithNibName:@"CellOne" bundle:[NSBundle mainBundle]];
    [_tableview registerNib:nib forCellReuseIdentifier:@"CellOne"];
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 3;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
//    NSString*Identifier1=@"CellOne";
//    NSString*Identifier2=@"CellOne";
    //NSArray*array=[NSBundle mainBundle]loadNibNamed:<#(NSString *)#> owner:<#(id)#> options:<#(NSDictionary *)#>
    if(indexPath.section==0){
     CellOne*cell=[tableView dequeueReusableCellWithIdentifier:@"CellOne" forIndexPath:indexPath];
    
        cell.imgV.image=[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:self.bk.ImageName]]];
        NSLog(@"%@",self.bk.ImageName);
        cell.author.text=self.bk.author;
        cell.booknamelabel.text=self.bk.bookname;
        cell.detail.text=self.bk.detail;
        return cell;
    }else{
    UITableViewCell*cell=[tableView dequeueReusableCellWithIdentifier:@"cell"];
        if(!cell){
            cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
                  }
         return cell;
    }
   
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    if(indexPath.section==0){
        return 120;
    }else{
        return 50;
    }
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
